
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <link href="/sap/demo.css" rel="stylesheet" type="text/css" />
    <script src="/sap/scripts/boot.js" type="text/javascript"></script>


    <style type="text/css">
        body{
            margin:0;padding:0;border:0;width:100%;height:100%;overflow:hidden;
        }
    </style>
</head>
<body>
<div class="mini-toolbar" style="text-align:center;line-height:30px;" borderStyle="border:0;">
    <label >供应商名称：</label>
    <input id="key" class="mini-textbox" style="width:150px;" onenter="onKeyEnter"/>

    &nbsp;&nbsp;&nbsp;

        <label class="col-sm-4 control-label" for="type">状态：</label>
            <select class="form-control" name="eq_type" id="eq_type">
                <option value="0">等待审核</option>
                <option value="1">审核通过</option>
                <option value="-1">审核未通过</option>
                <option value="all">全部</option>
            </select>


    <a class="mini-button" style="width:60px;" onclick="search()">查询</a>
</div>
<div class="mini-fit">

    <div id="grid1" class="mini-datagrid" style="width:100%;height:100%;"
         idField="id" allowResize="true"
         borderStyle="border-left:0;border-right:0;" onrowdblclick="onRowDblClick"
    >
        <div property="columns">
            <div type="indexcolumn" ></div>
            <div field="id" width="120" headerAlign="center" allowSort="false">供应商编号</div>
            <div field="name" width="100%" headerAlign="center" allowSort="false">供应商名称</div>
            <div field="examine_status" width="100%" headerAlign="center" allowSort="false">审核状态</div>
            <div field="operatorname" width="100%" headerAlign="center" allowSort="false">发起人</div>
            <div field="tel" width="100%" headerAlign="center" allowSort="false">供应商电话</div>
            <div field="ctime" width="100%" headerAlign="center" allowSort="false">发起日期</div>

        </div>
    </div>

</div>

</body>
</html>
<script type="text/javascript">
    mini.parse();

    var grid = mini.get("grid1");
    grid.setPageSize(50);
    //动态设置URL
    grid.setUrl("/index.php?m=&c=SapSupplier&a=getSupplierListData");
    //也可以动态设置列 grid.setColumns([]);

    grid.on("drawcell", function (e) {
        var record = e.record,
            column = e.column,
            field = e.field,
            value = e.value;
        if (field == "examine_status") {
            e.cellHtml =value==1?"通过":(value==0?"待审核":'未通过') ;
        }

        if (field == "ctime") {
            var date =mini.formatDate (  record.ctime,"yyyy-MM-dd HH:mm:ss" );
            e.cellHtml =date ;
        }

        if(record.examine_status==0)
            e.cellStyle = "background:#f9a8a8";
    });

    //grid.load();

    function GetData() {
        var row = grid.getSelected();
        return row;
    }
    function search() {
        var key = mini.get("key").getValue();
        //var eq_type = mini.get("eq_type").getValue();
        var eq_type = $("#eq_type").val();
        //alert($("#eq_type").val());
        grid.load({ c_name: key, eq_type:eq_type });
    }
    function onKeyEnter(e) {
        search();
    }
    function onRowDblClick(e) {
        // jump to detail page
        var grid = e.sender;
        var record = e.record;
        var id = record.id;
        var name = record.name;
        var rowIndex = e.rowIndex;

        //跳转至审批页面
        //top.location.href="/SapSupplier/index/?showbtn=1&supplierID="+id+"&supplierName="+name;

        //跳转至供应商修改页面
        top.location.href="/SapSupplier/supplieredit/id/"+id;
    }








</script>